package com.kitten.user.rpc;


import com.kitten.distributed_id_gen.api.DistributedIdGeneratorFeignApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class DistributedIdGeneratorRpcService {
    @Resource
    private DistributedIdGeneratorFeignApi distributedIdGeneratorFeignApi;

    /**
     * 生成: user的kittenbookId
     * 本Key要对应leaf数据库中业务标签的key, 有有这个行值记录
     */
    private static final String BIZ_TAG_KITTENBOOK_ID = "leaf-segment-kittenbook-id";

    /**
     * 生成: user的id
     */
    private static final String BIZ_TAG_USER_ID = "leaf-segment-user-id";


    /**
     * 生成 kittenbook的id
     * @return
     */
    public String getKittenbookId() {
        return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_KITTENBOOK_ID);
    }

    /**
     * 生成 user的id
     * @return
     */
    public String getUserId() {
        return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_USER_ID);
    }


}
